<script setup>
  import {ref} from "vue";

  const f = () => {
    alert('点击了')
  }

  const search =ref('')

  const ent = () => {
    alert('你输入了'+search.value+'关键字')
  }

</script>

<template>
  <h1>事件绑定指令</h1>
  <button @click="f">按钮1</button>
  <button v-on:click="f">按钮2</button>

  <h3>敲回车事件</h3>
<!--  v-model="search"双向绑定可以将页面输入的值存入search变量中
      @keydown.enter="ent"敲回车触发事件ent-->
<!--  <input type="text" @keyup.enter="ent" v-model="search">-->
  <input type="text" v-on:keyup.enter="ent">
</template>

<style scoped>

</style>